Skip to content

fix: support paragraph bar borders (w:pBdr/w:bar)#2742

Open
Abdeltoto wants to merge 1 commit intosuperdoc-dev:mainfrom
Abdeltoto:fix/paragraph-bar-border
Open

fix: support paragraph bar borders (w:pBdr/w:bar)#2742
Abdeltoto wants to merge 1 commit intosuperdoc-dev:mainfrom
Abdeltoto:fix/paragraph-bar-border

Conversation

@Abdeltoto
Copy link
Copy Markdown
Contributor

Summary

  • Add bar to ParagraphBorders type in contracts so it flows through the data model
  • Include bar in normalizeParagraphBorders() in the pm-adapter so the OOXML property is forwarded to the layout format
  • Render the bar border as a left-side vertical line in applyParagraphBorderStyles() in DomPainter
  • Include bar in the paragraph border hash for correct grouping comparisons

Files changed

  • Modified: contracts/src/index.tsbar?: ParagraphBorder on ParagraphBorders
  • Modified: pm-adapter/src/attributes/borders.tsbar in sides array
  • Modified: painters/dom/src/features/paragraph-borders/border-layer.ts — render bar as CSS left border
  • Modified: painters/dom/src/paragraph-hash-utils.ts — include bar in hash

Test plan

  • All existing border tests pass (81 between-border tests, 23 hash tests)
  • Pre-commit hooks pass (format + lint + commitlint)
  • Test with a .docx file containing w:pBdr/w:bar elements

Closes #2282

Add bar to ParagraphBorders type in contracts, include it in
normalizeParagraphBorders so it flows through the pm-adapter,
render it as a left-side vertical line in DomPainter, and
include it in the paragraph border hash for grouping parity.

Closes superdoc-dev#2282

Made-with: Cursor
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 974ecf97af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +219 to +220
if (borders.bar && borders.bar.style !== 'none') {
setBorderSideStyle(element, 'left', borders.bar);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include bar border in left-side geometry calculations

Applying borders.bar directly to border-left here introduces a rendering mismatch: the layer box is still expanded from borders.left only (computeBorderSpaceExpansion and computeRenderedBorderWidths), so bar.width/bar.space are not reserved. In paragraphs with only w:bar (or with a wider bar than left), the new bar border is drawn into the content box and can overlap text instead of being offset outward like other paragraph borders.

Useful? React with 👍 / 👎.

@caio-pizzol caio-pizzol self-assigned this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support paragraph bar borders (w:pBdr/w:bar)

2 participants